<template name='verify_order'>
	<uni-popup ref="buhuo" type="center" title="商品采购管理" width="98%">
		<view class="box-infos font12  " >
			<view class="content-box">

				<view class="boxsss40" >
					<view class="top-but menu-scroll-w">
						<view class="top-but-box">
						<view class="searchBoxs floatleft">
							<view class="riskTitle">
								交货时长：
							</view>
							<input
							v-model="search.leadTimeDays" 
							class="search-ipu "
							style="min-width: 50px;"
							placeholder="采购提前期的波动性"
							placeholder-class="placeholder-class"
							/>
							<view class="delete-ipu" v-if="search.leadTimeDays!=''" @click="search.leadTimeDays=''">
								<img src="../../static/img/delete-1.png"  ></img>
							</view>
						</view>
						<view class="searchBoxs floatleft">
							<view class="riskTitle">
								采购天数：
							</view>
							<input
							v-model="search.forecastDays" 
							class="search-ipu "
							style="min-width: 50px;"
							placeholder="未来天数的需求量"
							placeholder-class="placeholder-class"
							/>
							<view class="delete-ipu" v-if="search.forecastDays!=''" @click="search.forecastDays=''">
								<img src="../../static/img/delete-1.png"  ></img>
							</view>
						</view>
						
						<view class=" date-center floatleft" >
							<view class="riskTitle">
								预测采样范围：
							</view>
							
							<picker class="date-left" 
							mode="date" 
							:value="search.date.value[0]" 
							@change="changeStartDate"
							>
								<view class="uni-input cursor">{{search.date.value.length >0 ? search.date.value[0]:'开始时间'}}</view>
							</picker>
							
							<view class="date-c"> - </view>
							
							<picker class="date-left" 
							mode="date" 
							:value="search.date.value[1]" 
							@change="changeEndDate"
							>
								<view class="uni-input cursor">{{search.date.value.length >1 ? search.date.value[1]:'结束时间'}}</view>
							</picker>
							
							<view class="delete-ipu" 
							style="position: unset;transform: none;"
							v-if="search.date.value.length >1" 
							@click="search.date.value=[]"
							>
								<img src="../../static/img/delete-1.png"  ></img>
							</view>
						</view>
						
						<view class="searchBoxs floatleft">
							<view class="riskTitle">
								搜索商品：
							</view>
							<input
							:focus="search.focus"
							@blur="search.focus=false"
							v-model="search.word" 
							@confirm="$common.noMultipleClicks('loadData',loadData,true)"
							class="search-ipu w200"
							placeholder="输入商品名称 货位 ID 别称 首拼进行搜索"
							placeholder-class="placeholder-class"
							selection-start="0"
							:selection-end="search.selectEnd"
							@focus="search.selectEnd=search.word.length"
							/>
							<view class="delete-ipu" v-if="search.word!=''" @click="search.word='',search.focus=true">
								<img src="../../static/img/delete-1.png"  ></img>
							</view>
						</view>
						
						<view @click="$common.noMultipleClicks('loadData',loadData,true)" 
						class="button-erji " >
							<img src="../../static/img/update.png" class="ico"></img>
							搜索
						</view>
						
						
						<view @click="setting(1)" 
						:style="GetColor(1)"
						class="but" >
							10天内销售过
						</view>
						<view @click="setting(2)" 
						:style="GetColor(2)"
						class="but" >
							90天内销售过
						</view>
						<view @click="setting(3)" 
						:style="GetColor(3)"
						class="but" >
							90天前销售过
						</view>
						
						<view style="border-right: solid 2px #c5c5c5;"></view>
						
					
					
						<view style="border-right: solid 2px #c5c5c5;"></view>
						<a  class="but" :href="$common.baseUrl.host+'/forecasting_formula.html'" target="_blank">库存预测公式说明</a>
						
						</view>
					</view>
					
					<!-- 列表区 -->
					
						
					
					<table v-if="resData.list &&  resData.list.length>0">
						<!-- 表头 -->
						<thead>
							<tr >
								<th  class="centers " style="min-width: 20px;"
								@click="$common.changeColumnColor('table-buhuo',0)"
								>
									序
								</th>
								<th  
								@click="$common.changeColumnColor('table-buhuo',1)"
								>
									商品名称
								</th>
							
								<th class="centers " @click="$common.changeColumnColor('table-buhuo',3)">
									<view class="flex centers">
										<view>{{resData.diffDays}}天内销售合计</view>
										<view class="sort-button text-align">
											<view class="desc"  @click="tabClick(2,'desc')"></view>
											<view class="asc"   @click="tabClick(2,'asc')"></view>
										</view>
									</view>
								</th>
								<th class="centers " @click="$common.changeColumnColor('table-buhuo',4)">
									<view class="flex centers">
										<view>日均销售</view>
										<view class="sort-button text-align">
											<view class="desc"  @click="tabClick(4,'desc')"></view>
											<view class="asc"   @click="tabClick(4,'asc')"></view>
										</view>
									</view>
								</th>
								<th class="centers " @click="$common.changeColumnColor('table-buhuo',6)">
									<view class="flex centers">
										<view>最后销售时间</view>
									</view>
								</th>
								<th class="centers " @click="$common.changeColumnColor('table-buhuo',7)">
									库存范围
								</th>
								<th  class="centers " @click="$common.changeColumnColor('table-buhuo',8)">
									<view class="flex centers">
										<view>实时库存</view>
										<view class="sort-button text-align">
											<view class="desc"  @click="tabClick(6,'desc')"></view>
											<view class="asc"   @click="tabClick(6,'asc')"></view>
										</view>
									</view>
								</th>
								<th  class="centers " @click="$common.changeColumnColor('table-buhuo',9)">
									<view class="flex centers">
										<view>基于库存容量的采购量</view>
										<view class="sort-button text-align">
											<view class="desc"  @click="tabClick(7,'desc')"></view>
											<view class="asc"   @click="tabClick(7,'asc')"></view>
										</view>
									</view>
								</th>
								<th  class="centers " @click="$common.changeColumnColor('table-buhuo',10)">
									<view class="flex centers">
										<view>基于需求预测的采购量</view>
										<view class="sort-button text-align">
											<view class="desc"  @click="tabClick(8,'desc')"></view>
											<view class="asc"   @click="tabClick(8,'asc')"></view>
										</view>
									</view>
								</th>
								<th  class="centers " @click="$common.changeColumnColor('table-buhuo',11)">
									补货数量
								</th>
								<th  class="centers " @click="$common.changeColumnColor('table-buhuo',12)">
									<view class="flex centers">
										<view>建议</view>
										
									</view>
								</th>
							</tr>
						</thead>
						<tbody>
							<!-- 内容 -->
							
								<tr @click="TabcheckedIndex=index" 
								:key="index"
								v-for="(item,index) in resData.list" 
								:class="TabcheckedIndex == index || item.value>0? 'goods-list-select':''"
								v-if="GetSetting(item) && GetSetting1(item)"
								>
									<td  class="centers col-0" >
										<view class="flex centers">
											
											<view class="center">
												{{index+1}}
											</view>
										</view>
									</td>
									<td class="centers col-1">
										<view class="  font12 relative flex">
											<view>{{item.name}}</view>
											<view class="back_data">
												<image src="/static/img/order_type.png" :title="$global.title.m29" class="ico" v-if="item.order_status==1"></image>
												<image src="/static/img/goods_back.png" :title="$global.title.m16" class="ico" v-if="item.back==0"></image>
												<image src="/static/img/goods_misk.png" :title="$global.title.m17" class="ico" v-if="item.goodsIsProfit"></image>
												<image src="/static/img/cz_record.png"  :title="$global.title.m39" class="ico"v-if="item.money_record==0" @click.stop="$refs.chongzhang_order.open(item.id)"></image>
											</view>
										</view>
									</td>
									
									
									<td class="centers col-3" >
										{{item.monthly_sales_sum}}
									</td>
							
								
									<td class="centers col-5" >
										{{item.dailySales.toFixed(2)}}
									</td>
									<td class="centers col-6" 
									:style="{'color':'#fff','background-color':item.timeDiff<=10?global_timeDiff_color.timeDiff_10 :(item.timeDiff<=90 ? global_timeDiff_color.timeDiff_90:global_timeDiff_color.timeDiff_91)}"
									>
										{{item.timeDiff}}天前
									</td>
									<td class="centers col-7">
										{{item.margin_start+'-'+item.margin_end}}
									</td>
									<td class="centers col-8"
									:style="{color:item.margin<parseInt(item.margin_start)?global_timeDiff_color.timeDiff_91:(item.margin>parseInt(item.margin_end)?global_timeDiff_color.timeDiff_10:global_timeDiff_color.timeDiff_93)}"
									>
										{{item.margin}}
									</td>
									<td  class="centers col-9"
									:style="{color:item.safe_quantity>0?global_timeDiff_color.timeDiff_91:(item.extra_quantity>0?global_timeDiff_color.timeDiff_93:global_timeDiff_color.timeDiff_10)}"
									:title="$global.title.m44"
									@click="onsetDataCount(item.safe_quantity,index) "
									>
										<view class="flex gap10">
											<text class="tipssm">点击补货</text>
											<text>{{item.safe_quantity}}</text>
										</view>
									</td>
									
									<td  class="centers colorGoodsMoney font1 col-10" 
									:style="{color:item.safe_quantity>0?global_timeDiff_color.timeDiff_91:(item.extra_quantity>0?global_timeDiff_color.timeDiff_93:global_timeDiff_color.timeDiff_10)}"
									:title="$global.title.m45"
									@click="onsetDataCount(item.extra_quantity,index) "
									>
										<view class="flex gap10">
											<text class="tipssm">点击补货</text>
											<text>{{item.extra_quantity}}</text>
										</view>
									</td>
									
									<td class="col-11" style="width: 100px;">
										<view class="goodsCountColor">
											<input
											style="    height: auto;"
											v-model="item.value"
											class="centers white-space goodsNameColor font16"
											/>
											
											<view class="delete-ipu" v-if="item.value>0" @click="item.value=0">
												<img src="../../static/img/delete-1.png"  ></img>
											</view>
										</view>
									</td>
									
									
									<td  class="centers col-12"
									:style="{'color':'#fff','background-color':item.safe_quantity>0 && item.extra_quantity>0?global_timeDiff_color.timeDiff_91:(item.safe_quantity>0 ?global_timeDiff_color.timeDiff_93 :(item.extra_quantity>0?global_timeDiff_color.timeDiff_92:global_timeDiff_color.timeDiff_10) )}"
									:title="item.safe_quantity>0?$global.title.m41:(item.extra_quantity>0?$global.title.m42:$global.title.m43)"
									>
										{{item.safe_quantity>0 && item.extra_quantity>0 ?'需紧急补货':(item.safe_quantity>0 || item.extra_quantity>0 ?'建议补货':'库存健康')}}
									</td>
								</tr>
							
							
						</tbody>
					</table>
					<!-- 暂无数据 -->
					<empty v-if="resData.list &&  resData.list.length==0"></empty>
					<!-- end -->
				
						
					
					<!-- end -->
				</view>
				
				<pages 
				style="margin-bottom: 40px;"
				:sum="page.sum"
				:current="page.nowPage"
				@updatePage="updatePage"
				></pages>
				
				<!-- 操作区 -->
				<view class="top-but search-box">
					<view class="caogao-but-box">
						<text selectable="true"  class="shuoming">点击【保存至草稿但】会把补货数量>0的商品加入草稿单，请确认无误后点击</text>
						
						<view @click="$common.noMultipleClicks('sned_on_goods',sned_on_goods,true)" 
						class="rightButttom" 
						style="margin-left: 10px;"
						>
							<!-- <img src="../../static/img/search.png" class="ico"></img> -->
							保存至草稿单
						</view>
					</view>
				</view>
				<!-- end -->
			</view>
		</view>
	</uni-popup>
</template>

<script>
	import pages from "@/components/admin-components/pages.vue"
	import empty from "@/components/admin-components/empty.vue"
	export default{
		name:'verify_order',
		components: {
			empty,
			pages,
		},
		data(){
			return{
				TabcheckedIndex:-1,//当前选中项
				global_timeDiff:{
					timeDiff_10:false,
					timeDiff_90:false,
					timeDiff_91:false,
					
					
					status1:false,
					status2:false,
					status3:false,
					status4:false,
				},
				global_timeDiff_color:{
					timeDiff_10:'#00d500',
					timeDiff_90:'#fbdc00',
					timeDiff_91:'#ff0000',
					timeDiff_92:'#ff1977',
					timeDiff_93:'#7777ff',
				},
				search:{// 搜索栏
					focus:false,//是否获得焦点
					word:'',//搜索内容
					screen:1,//搜索方式
					selectEnd:0,
					leadTimeDays:'0',//供应商交货时间（默认7天）
					forecastDays:'30',//预测天数（默认30天）
					date:{
						value:[]
					},
				},
				resData:{
					list:[]
				},
			
				page:{
					
					nowPage:1,//当前页数
					pageCount:1,//总页数
					maxCount:0,
					sum:0,
					pageCounts:15,
				},
				sort:{//排序方式
					value:'',
					index:0
				},
				OnPageUserId: '',//需要的用户ID
			}
		},
		created() {
			const today = new Date(); // 当前日期
			const formattedToday = today.toISOString().split('T')[0]; // 格式化为 "YYYY-MM-DD"
			
			const pastDate = new Date();
			pastDate.setDate(today.getDate() - 30); // 减去 30 天
			const formattedPastDate = pastDate.toISOString().split('T')[0]; // 格式化为 "YYYY-MM-DD"
			this.search.date.value.push(formattedPastDate,formattedToday) 
		},
		methods:{
			//回调第一个时间
			changeStartDate(res){
				this.search.date.value[0] = res.detail.value
				this.$set(this.search.date.value,0,this.search.date.value[0])
			},
			//回调第二个时间
			changeEndDate(res){
				this.search.date.value[1] = res.detail.value
				this.$set(this.search.date.value,1,this.search.date.value[1])
			},
			onsetDataCount(value,index){
				this.resData.list[index].value = value
				this.$set(this.resData.list,index,this.resData.list[index])
			},
			sned_on_goods(){
				var list = this.resData.list;
				var arr = []
				for(var i=0;i<list.length;i++){
					if(list[i].value > 0){
						arr.push({id:list[i].id,count:list[i].value})
					}
				}
				if(arr.length>0){
					this.$emit('on_goods',arr)
				}else{
					this.$common.showModal('提示','请在需要补货商品后的输入框内填写补货数量后再进行保存')
				}
			},
			GetColor(type){
				if(type==1 ){
					var color = this.global_timeDiff.timeDiff_10==true ? "#333":this.global_timeDiff_color.timeDiff_10
					var background_color = this.global_timeDiff.timeDiff_10==true ? this.global_timeDiff_color.timeDiff_10:''
					
				}else if(type==2 ){
					var color = this.global_timeDiff.timeDiff_90==true ? "#333":this.global_timeDiff_color.timeDiff_90
					var background_color = this.global_timeDiff.timeDiff_90==true ? this.global_timeDiff_color.timeDiff_90:''
				}else if(type==3 ){
					var color = this.global_timeDiff.timeDiff_91==true ? "#333":this.global_timeDiff_color.timeDiff_91
					var background_color = this.global_timeDiff.timeDiff_91==true ? this.global_timeDiff_color.timeDiff_91:''
				}else if(type==11 ){
					var color = this.global_timeDiff.status1==true ? "#333":this.global_timeDiff_color.timeDiff_91
					var background_color = this.global_timeDiff.status1==true ? this.global_timeDiff_color.timeDiff_91:''
				}else if(type==12 ){
					var color = this.global_timeDiff.status2==true ? "#333":this.global_timeDiff_color.timeDiff_92
					var background_color = this.global_timeDiff.status2==true ? this.global_timeDiff_color.timeDiff_92:''
				}else if(type==13 ){
					var color = this.global_timeDiff.status3==true ? "#333":this.global_timeDiff_color.timeDiff_93
					var background_color = this.global_timeDiff.status3==true ? this.global_timeDiff_color.timeDiff_93:''
				}else if(type==14 ){
					var color = this.global_timeDiff.status4==true ? "#333":this.global_timeDiff_color.timeDiff_10
					var background_color = this.global_timeDiff.status4==true ? this.global_timeDiff_color.timeDiff_10:''
				}
				return {'color':color,'background-color':background_color}
			},
			GetSetting(item){
				if(this.global_timeDiff.timeDiff_10==true && item.timeDiff<=10) return true ;
				if(this.global_timeDiff.timeDiff_90==true && item.timeDiff<=90) return true;
				if(this.global_timeDiff.timeDiff_91==true && item.timeDiff>90) return true;
				if(this.global_timeDiff.timeDiff_10==false && this.global_timeDiff.timeDiff_90==false && this.global_timeDiff.timeDiff_91==false) return true;
				return false;
			},
			GetSetting1(item){
				if(this.global_timeDiff.status1==true && item.safe_quantity>0 && item.extra_quantity>0) return true;
				if(this.global_timeDiff.status2==true && item.extra_quantity>0 && item.safe_quantity<=0) return true;
				if(this.global_timeDiff.status3==true && item.safe_quantity>0 && item.extra_quantity<=0) return true;
				if(this.global_timeDiff.status4==true && item.safe_quantity<=0 && item.extra_quantity<=0) return true;
				
				if(this.global_timeDiff.status1==false && this.global_timeDiff.status2==false && this.global_timeDiff.status3==false && this.global_timeDiff.status4==false) return true;
				return false;
			},
			setting(type){
				this.global_timeDiff.timeDiff_10 = false
				this.global_timeDiff.timeDiff_90 = false
				this.global_timeDiff.timeDiff_91 = false
				
				if(type ==1){
					this.global_timeDiff.timeDiff_10 = true
				}else if(type ==2){
					this.global_timeDiff.timeDiff_90 = true
				}else if(type ==3){
					this.global_timeDiff.timeDiff_91 = true
				}
			},
			setting1(type){
				
				this.global_timeDiff.status1 = false
				this.global_timeDiff.status2 = false
				this.global_timeDiff.status3 = false
				this.global_timeDiff.status4 = false
				
				if(type ==11){
					this.global_timeDiff.status1 = true
				}else if(type ==12){
					this.global_timeDiff.status2 = true
				}else if(type ==13){
					this.global_timeDiff.status3 = true
				}else if(type ==14){
					this.global_timeDiff.status4 = true
				}
			},
			/**
			 * 计算当前日期与指定日期的天数差（当前日期 - 过去日期）
			 * @param {string} pastDateStr 过去的日期字符串（格式：YYYY-MM-DD 或 YYYY/MM/DD）
			 * @returns {number|object} 返回天数差（整数），出错时返回错误对象
			 */
			getDaysSince(pastDateStr) {
			    // 1. 参数基础校验
			    if (typeof pastDateStr !== 'string') {
			        console.log( {
			            error: true,
			            message: '输入必须是字符串类型',
			            received: typeof pastDateStr
			        });
					return 999;
			    }
			
			    // 2. 日期格式校验（支持YYYY-MM-DD和YYYY/MM/DD）
			    const dateRegex = /^(\d{4})[-/](\d{2})[-/](\d{2})$/;
			    if (!dateRegex.test(pastDateStr)) {
			        
					return 999;
			    }
			
			    // 3. 转换日期对象
			    const normalizeDate = (dateStr) => {
			        // 统一替换分隔符为破折号
			        const normalized = dateStr.replace(/\//g, '-');
			        const date = new Date(normalized);
			        
			        // 验证日期有效性（防止无效日期如2023-02-30）
			        const [year, month, day] = normalized.split('-').map(Number);
			        const reconstructed = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
			        
			        if (
			            isNaN(date.getTime()) || 
			            date.toISOString().slice(0, 10) !== reconstructed
			        ) {
			            throw new Error('无效的日历日期');
			        }
			        
			        return date;
			    };
			
			    try {
			        // 4. 获取并验证过去日期
			        const pastDate = normalizeDate(pastDateStr);
			        
			        // 5. 获取当前日期（去掉时间部分）
			        // const now = new Date();
			        // const currentDate = new Date(
			        //     now.getFullYear(),
			        //     now.getMonth(),
			        //     now.getDate()
			        // );
			        var today = new Date();
			        var currentDate = today.getFullYear() + '-' + (String(today.getMonth() + 1).padStart(2, '0')) + '-' + String(today.getDate()).padStart(2, '0');
					currentDate = new Date(currentDate)
					
			        // 6. 验证日期范围（过去日期不能晚于当前日期）
			        if (pastDate > currentDate) {
			             console.log(  {
			                error: true,
			                message: '输入的日期不能晚于当前日期',
			                pastDate: pastDate.toISOString().slice(0, 10),
			                currentDate: currentDate.toISOString().slice(0, 10)
			            });
						return 999;
			        }
			
			        // 7. 计算天数差（使用UTC避免夏令时影响）
			        const ONE_DAY_MS = 24 * 60 * 60 * 1000;
			        const timeDiff = currentDate - pastDate;
			        const daysDiff = Math.floor(timeDiff / ONE_DAY_MS);
			
			        // 8. 返回结果
			        return daysDiff;
			    } catch (error) {
			        // 捕获并返回可能的错误
			        console.log( {
			            error: true,
			            message: error.message,
			            received: pastDateStr,
			            stack: error.stack
			        });
					return 999;
			    }
			},
			open(uid) {
				this.OnPageUserId = uid
				this.$refs.buhuo.open()
			},
			close() {
			  this.$refs.buhuo.close()
			},
			/**
			 * 分页器回调
			*/
			updatePage(pageName,pageCount){
				var that = this
				that.page.nowPage = pageName
				that.page.pageCounts = pageCount
				that.loadData(false);
			},
			
			/**
			 * 筛选点击
			 * 排序
			*/
			tabClick(name,type){
				let arr = this.resData.list
				if(name==1){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.last_purchase_sum - a.last_purchase_sum
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.last_purchase_sum - b.last_purchase_sum
							}
						);
					}
					
				}else if(name==2){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.monthly_sales_sum - a.monthly_sales_sum
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.monthly_sales_sum - b.monthly_sales_sum
							}
						);
					}
				
				}else if(name==3){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.time - a.time
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.time - b.time
							}
						);
					}
				
				} else if(name == 4){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.dailySales -a.dailySales
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.dailySales -b.dailySales
							}
						);
					}
				} else if(name == 5){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.monthly_sales -a.monthly_sales
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.monthly_sales -b.monthly_sales
							}
						);
					}
				} else if(name == 6){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.margin -a.margin
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.margin -b.margin
							}
						);
					}
				} else if(name == 7){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.safe_quantity -a.safe_quantity
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.safe_quantity -b.safe_quantity
							}
						);
					}
				} else if(name == 8){
					if(type=='desc'){
						arr.sort(function(a,b){
								return b.extra_quantity -a.extra_quantity
							}
						);
					}else{
						arr.sort(function(a,b){
								return a.extra_quantity -b.extra_quantity
							}
						);
					}
				}
				this.resData.list = arr
			},
			
			GetBody(isUpdatePage){
				this.page.nowPage = isUpdatePage==true ? 1:this.page.nowPage;
				
				if(this.search.date.value.length>0){
					var time_start = this.search.date.value[0]
					var time_end = this.search.date.value[1]
				}else{
					var time_start = ''
					var time_end = ''
				}
				return {
						type:'GetGoodsPurchase',
						search:this.search.word,//搜索内容
						forecastDays:this.search.forecastDays,//搜索内容
						leadTimeDays:this.search.leadTimeDays,//搜索内容
						pages:this.page.nowPage,//当前位于页数
						page_count:this.page.pageCounts,//当前请求页的数量
						sort:this.sort.value,
						uid:this.OnPageUserId,//指定厂家
						time_start:time_start,//
						time_end:time_end,//
				};
			},
			/**
			 * 读取商品
			 * type : goods_list|goods_search
			 * isUpdatePage : 如果是分页器回调的就不出时候页码，如果是点击获取数据的就初始化页码为1
			 * 
			*/
			loadData(isUpdatePage=true){
				var that = this
				this.global_timeDiff = {
					timeDiff_10:false,
					timeDiff_90:false,
					timeDiff_91:false,
					
					
					status1:false,
					status2:false,
					status3:false,
					status4:false,
				}
				
				//常规的筛选项
				var body = this.GetBody(isUpdatePage)
				that.$common.get_request(
					body,
					(res)=>{
						
						that.page.sum  = res.sum
						if(isUpdatePage == true){
						that.page.nowPage  = 1
						}
						 if(res.list.length > 0){
							 that.TabcheckedIndex = 0//初始化列表选中项
						 }else{
							 that.TabcheckedIndex = -1//初始化列表选中项
						 }
						 for(var i=0;i<res.list.length;i++){
							 res.list[i].timeDiff = that.getDaysSince(res.list[i].end_purchase_time)
							
						 }
						 
						 that.resData = res
						that.tabClick(8,'desc')
					}
				);
			},
			
		}
	}
</script>

<style>
	.but{
		flex-direction: column;
		justify-content: center;
		align-items: center;
		display: flex;
		margin: 5px 2px;
		padding: 1px 3px;
		border-radius: 5px;
		min-width: 90px;
	}
	.but:hover{
		box-shadow: 0 0 4px -2px #333;
	}
	.row{
		display: flex;
		flex-direction: row;
		height: 100%;
		background-color: #fff;
		overflow: hidden;
		width: 100%;
		align-items: center;
	}
	.addc{
		text-rendering: optimizelegibility;
		writing-mode: vertical-rl;
		height: auto;
		line-height: 23px;
		min-width: auto;
		margin: auto 10px;
		padding: 10px 5px;
		border-radius: 5px;
		display: flex;
		background-color: #0f66e0;
		cursor: pointer;
		color: #fff;
		font-size: 14px;
		justify-content: center;
		align-items: center;
	}
	.goodsCountColor {
		background-color: #f5f7fa;
		position: relative;
		display: flex;
		width: 100px;
	}
	.shuoming{
		height: auto;
		justify-content: center;
		display: flex;
		flex-direction: column;
		margin-left: auto;
		color: #333;
	}
	.tipssm{
		color: #999;
		font-size: 12px;
	}
</style>
